﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_CB_ZILAISGSSJ实体层次
//********************************************************************************//

#region Entity

using System;
using System.Data;
using Entity;
using Oracle.DataAccess.Client;
using Platform.Configuration;
using Platform.Data;

namespace Entity
{
    [Serializable]
    public class YS_CB_ZILAISGSSJ
    {
        private decimal? m_dec_i_assesstype;

        private decimal? m_dec_i_benyuecm;

        private decimal? m_dec_i_chaobiaozt;

        private decimal? m_dec_i_dummywatchflat;

        private decimal? m_dec_i_gjcs;

        private decimal? m_dec_i_jlzt;

        private decimal? m_dec_i_koujing;

        private decimal? m_dec_i_m;

        private decimal? m_dec_i_shangyuecm;

        private decimal? m_dec_i_type;

        private decimal? m_dec_i_writrtype;

        private decimal? m_dec_i_y;

        private decimal? m_dec_i_yongshuil;

        private decimal m_dec_id;

        private DateTime? m_DT_d_chaobiaorq;

        private DateTime? m_DT_d_zhuangbiaorq;

        private float? m_f_n_ysj;

        private string m_str_s_beiyong1;

        private string m_str_s_beiyong2;

        private string m_str_s_beiyong3;

        private string m_str_s_beiyong4;

        private string m_str_s_beiyong5;

        private string m_str_s_beiyong6;

        private string m_str_s_bfl;

        private string m_str_s_bx;

        private string m_str_s_cantonid;

        private string m_str_s_dept;

        private string m_str_s_guanlikbh;

        private string m_str_s_jianhao;

        private string m_str_s_kuaihao;

        private string m_str_s_shuibiaobh;

        private string m_str_s_shuibiaoch;

        private string m_str_s_shuibiaodz;

        private string m_str_s_shuibiaohm;

        private string m_str_s_watercompanyid;

        private string m_str_s_writedeptid;

        private string m_str_s_yonghuh;

        private string m_str_s_yuanchaobzt;

        private string m_str_s_yuanshuibbh;

        private string m_str_s_zbh;

        private string m_str_s_zhandianbh;

        /// <summary>
        ///     原表为空   应该是站点编号
        /// </summary>
        public string S_ZHANDIANBH
        {
            get { return m_str_s_zhandianbh; }
            set { m_str_s_zhandianbh = value; }
        }

        /// <summary>
        ///     水表编号
        /// </summary>
        public string S_SHUIBIAOBH
        {
            get { return m_str_s_shuibiaobh; }
            set { m_str_s_shuibiaobh = value; }
        }

        /// <summary>
        ///     水量年
        /// </summary>
        public decimal? I_Y
        {
            get { return m_dec_i_y; }
            set { m_dec_i_y = value; }
        }

        /// <summary>
        ///     水量月
        /// </summary>
        public decimal? I_M
        {
            get { return m_dec_i_m; }
            set { m_dec_i_m = value; }
        }

        /// <summary>
        ///     源水表编号
        /// </summary>
        public string S_YUANSHUIBBH
        {
            get { return m_str_s_yuanshuibbh; }
            set { m_str_s_yuanshuibbh = value; }
        }

        /// <summary>
        ///     管理块编号
        /// </summary>
        public string S_GUANLIKBH
        {
            get { return m_str_s_guanlikbh; }
            set { m_str_s_guanlikbh = value; }
        }

        /// <summary>
        ///     水表册号
        /// </summary>
        public string S_SHUIBIAOCH
        {
            get { return m_str_s_shuibiaoch; }
            set { m_str_s_shuibiaoch = value; }
        }

        /// <summary>
        ///     块号
        /// </summary>
        public string S_KUAIHAO
        {
            get { return m_str_s_kuaihao; }
            set { m_str_s_kuaihao = value; }
        }

        /// <summary>
        ///     水表类型
        /// </summary>
        public decimal? I_TYPE
        {
            get { return m_dec_i_type; }
            set { m_dec_i_type = value; }
        }

        /// <summary>
        ///     水表地址
        /// </summary>
        public string S_SHUIBIAODZ
        {
            get { return m_str_s_shuibiaodz; }
            set { m_str_s_shuibiaodz = value; }
        }

        /// <summary>
        ///     水表户名
        /// </summary>
        public string S_SHUIBIAOHM
        {
            get { return m_str_s_shuibiaohm; }
            set { m_str_s_shuibiaohm = value; }
        }

        /// <summary>
        ///     原表c_bx
        /// </summary>
        public string S_BX
        {
            get { return m_str_s_bx; }
            set { m_str_s_bx = value; }
        }

        /// <summary>
        ///     装表日期
        /// </summary>
        public DateTime? D_ZHUANGBIAORQ
        {
            get { return m_DT_d_zhuangbiaorq; }
            set { m_DT_d_zhuangbiaorq = value; }
        }

        /// <summary>
        ///     简号
        /// </summary>
        public string S_JIANHAO
        {
            get { return m_str_s_jianhao; }
            set { m_str_s_jianhao = value; }
        }

        /// <summary>
        ///     口径
        /// </summary>
        public decimal? I_KOUJING
        {
            get { return m_dec_i_koujing; }
            set { m_dec_i_koujing = value; }
        }

        /// <summary>
        ///     用水价
        /// </summary>
        public float? N_YSJ
        {
            get { return m_f_n_ysj; }
            set { m_f_n_ysj = value; }
        }

        /// <summary>
        ///     上月抄码
        /// </summary>
        public decimal? I_SHANGYUECM
        {
            get { return m_dec_i_shangyuecm; }
            set { m_dec_i_shangyuecm = value; }
        }

        /// <summary>
        ///     抄表日期
        /// </summary>
        public DateTime? D_CHAOBIAORQ
        {
            get { return m_DT_d_chaobiaorq; }
            set { m_DT_d_chaobiaorq = value; }
        }

        /// <summary>
        ///     本月抄码
        /// </summary>
        public decimal? I_BENYUECM
        {
            get { return m_dec_i_benyuecm; }
            set { m_dec_i_benyuecm = value; }
        }

        /// <summary>
        ///     用水量
        /// </summary>
        public decimal? I_YONGSHUIL
        {
            get { return m_dec_i_yongshuil; }
            set { m_dec_i_yongshuil = value; }
        }

        /// <summary>
        ///     抄表状态
        /// </summary>
        public decimal? I_CHAOBIAOZT
        {
            get { return m_dec_i_chaobiaozt; }
            set { m_dec_i_chaobiaozt = value; }
        }

        /// <summary>
        ///     源抄表状态
        /// </summary>
        public string S_YUANCHAOBZT
        {
            get { return m_str_s_yuanchaobzt; }
            set { m_str_s_yuanchaobzt = value; }
        }

        /// <summary>
        ///     0正常 1删除
        /// </summary>
        public decimal? I_JLZT
        {
            get { return m_dec_i_jlzt; }
            set { m_dec_i_jlzt = value; }
        }

        /// <summary>
        ///     原表C_dept
        /// </summary>
        public string S_DEPT
        {
            get { return m_str_s_dept; }
            set { m_str_s_dept = value; }
        }

        /// <summary>
        ///     原表I_GJCS
        /// </summary>
        public decimal? I_GJCS
        {
            get { return m_dec_i_gjcs; }
            set { m_dec_i_gjcs = value; }
        }

        /// <summary>
        ///     原表C_WATERCOMPANYID
        /// </summary>
        public string S_WATERCOMPANYID
        {
            get { return m_str_s_watercompanyid; }
            set { m_str_s_watercompanyid = value; }
        }

        /// <summary>
        ///     原表C_WRITEDEPTID
        /// </summary>
        public string S_WRITEDEPTID
        {
            get { return m_str_s_writedeptid; }
            set { m_str_s_writedeptid = value; }
        }

        /// <summary>
        ///     原表C_CANTONID
        /// </summary>
        public string S_CANTONID
        {
            get { return m_str_s_cantonid; }
            set { m_str_s_cantonid = value; }
        }

        /// <summary>
        ///     原表C_BFL
        /// </summary>
        public string S_BFL
        {
            get { return m_str_s_bfl; }
            set { m_str_s_bfl = value; }
        }

        /// <summary>
        ///     原表c_zbh
        /// </summary>
        public string S_ZBH
        {
            get { return m_str_s_zbh; }
            set { m_str_s_zbh = value; }
        }

        /// <summary>
        ///     I_ASSESSTYPE
        /// </summary>
        public decimal? I_ASSESSTYPE
        {
            get { return m_dec_i_assesstype; }
            set { m_dec_i_assesstype = value; }
        }

        /// <summary>
        ///     原表I_DUMMYWATCHFLAT
        /// </summary>
        public decimal? I_DUMMYWATCHFLAT
        {
            get { return m_dec_i_dummywatchflat; }
            set { m_dec_i_dummywatchflat = value; }
        }

        /// <summary>
        ///     c_Userid
        /// </summary>
        public string S_YONGHUH
        {
            get { return m_str_s_yonghuh; }
            set { m_str_s_yonghuh = value; }
        }

        /// <summary>
        ///     I_WRITRTYPE
        /// </summary>
        public decimal? I_WRITRTYPE
        {
            get { return m_dec_i_writrtype; }
            set { m_dec_i_writrtype = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG1
        {
            get { return m_str_s_beiyong1; }
            set { m_str_s_beiyong1 = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG2
        {
            get { return m_str_s_beiyong2; }
            set { m_str_s_beiyong2 = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG3
        {
            get { return m_str_s_beiyong3; }
            set { m_str_s_beiyong3 = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG4
        {
            get { return m_str_s_beiyong4; }
            set { m_str_s_beiyong4 = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG5
        {
            get { return m_str_s_beiyong5; }
            set { m_str_s_beiyong5 = value; }
        }

        /// <summary>
        ///     备用
        /// </summary>
        public string S_BEIYONG6
        {
            get { return m_str_s_beiyong6; }
            set { m_str_s_beiyong6 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal ID
        {
            get { return m_dec_id; }
            set { m_dec_id = value; }
        }
    }
}

#endregion

#region EntityProcess

namespace BLL.Access
{
    //using System.Data.OracleClient;

    public class YS_CB_ZILAISGSSJProcess
    {
        #region Field

        protected string conn;

        #endregion

        #region Construction

        public YS_CB_ZILAISGSSJProcess()
        {
            conn = ConfigHelper.PlatformConnString;
        }

        #endregion

        #region public

        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ实体添加或者修改YS_CB_ZILAISGSSJ信息
        /// </summary>
        public bool InsertOrUpdate(YS_CB_ZILAISGSSJ YS_CB_ZILAISGSSJ, OracleTransaction Transaction)
        {
            if (YS_CB_ZILAISGSSJ.ID == 0)
                InsertYS_CB_ZILAISGSSJ(YS_CB_ZILAISGSSJ, Transaction);
            else
                UpdateYS_CB_ZILAISGSSJ(YS_CB_ZILAISGSSJ, Transaction);
            return YS_CB_ZILAISGSSJ.ID == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ实体添加或修改YS_CB_ZILAISGSSJ信息
        /// </summary>
        public bool InsertOrUpdate(YS_CB_ZILAISGSSJ YS_CB_ZILAISGSSJ)
        {
            return InsertOrUpdate(YS_CB_ZILAISGSSJ, null);
        }


        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ主键删除YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_CB_ZILAISGSSJ(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_CB_ZILAISGSSJ";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ主键删除YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_CB_ZILAISGSSJ(decimal ID)
        {
            return DeleteYS_CB_ZILAISGSSJ(ID, null);
        }

        /// <summary>
        ///     根据条件删除YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_CB_ZILAISGSSJsDynamic(string WhereClause, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_CB_ZILAISGSSJsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据条件删除YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_CB_ZILAISGSSJsDynamic(string WhereClause)
        {
            return DeleteYS_CB_ZILAISGSSJsDynamic(WhereClause, null);
        }

        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ主键选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public YS_CB_ZILAISGSSJ SelectYS_CB_ZILAISGSSJ(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_CB_ZILAISGSSJ";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                var YS_CB_ZILAISGSSJ = PopulateYS_CB_ZILAISGSSJ(rd);
                rd.Close();
                return YS_CB_ZILAISGSSJ;
            }
            return null;
        }

        /// <summary>
        ///     根据YS_CB_ZILAISGSSJ主键选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public YS_CB_ZILAISGSSJ SelectYS_CB_ZILAISGSSJ(decimal ID)
        {
            return SelectYS_CB_ZILAISGSSJ(ID, null);
        }

        /// <summary>
        ///     选择所有YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsAll(OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_CB_ZILAISGSSJsAll";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }

        /// <summary>
        ///     选择所有YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <returns>所有YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsAll()
        {
            return SelectYS_CB_ZILAISGSSJsAll(null);
        }

        /// <summary>
        ///     根据条件选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsDynamic(string WhereClause, string OrderByExpression,
            OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_CB_ZILAISGSSJsDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectYS_CB_ZILAISGSSJsDynamic(WhereClause, OrderByExpression, null);
        }


        /// <summary>
        ///     根据条件选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_CB_ZILAISGSSJsDynPaged";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            storedParams[2].Value = PageIndex;
            storedParams[3].Value = PageSize;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_CB_ZILAISGSSJ信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <returns>YS_CB_ZILAISGSSJ信息</returns>
        public DataTable SelectYS_CB_ZILAISGSSJsDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize)
        {
            return SelectYS_CB_ZILAISGSSJsDynamic(WhereClause, OrderByExpression, PageIndex, PageSize, null);
        }

        /// <summary>
        ///     根据条件更新YS_CB_ZILAISGSSJ字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_CB_ZILAISGSSJsDynamic(string UpdateValue, string WhereClause, OracleTransaction Transaction)
        {
            var result = 0;
            if (UpdateValue == "" || WhereClause == "")
                return 0;
            var spName = "CS_UpdYS_CB_ZILAISGSSJDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            result = Convert.ToInt32(storedParams[2].Value);
            return result;
        }

        /// <summary>
        ///     根据条件更新YS_CB_ZILAISGSSJ字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_CB_ZILAISGSSJsDynamic(string UpdateValue, string WhereClause)
        {
            return UpdateYS_CB_ZILAISGSSJsDynamic(UpdateValue, WhereClause, null);
        }

        #endregion

        #region Private

        private int InsertYS_CB_ZILAISGSSJ(YS_CB_ZILAISGSSJ YS_CB_ZILAISGSSJ, OracleTransaction Transaction)
        {
            var spName = "CS_InsYS_CB_ZILAISGSSJ";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_CB_ZILAISGSSJ.S_ZHANDIANBH;
            storedParams[1].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOBH;
            storedParams[2].Value = YS_CB_ZILAISGSSJ.I_Y;
            storedParams[3].Value = YS_CB_ZILAISGSSJ.I_M;
            storedParams[4].Value = YS_CB_ZILAISGSSJ.S_YUANSHUIBBH;
            storedParams[5].Value = YS_CB_ZILAISGSSJ.S_GUANLIKBH;
            storedParams[6].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOCH;
            storedParams[7].Value = YS_CB_ZILAISGSSJ.S_KUAIHAO;
            storedParams[8].Value = YS_CB_ZILAISGSSJ.I_TYPE;
            storedParams[9].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAODZ;
            storedParams[10].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOHM;
            storedParams[11].Value = YS_CB_ZILAISGSSJ.S_BX;
            storedParams[12].Value = YS_CB_ZILAISGSSJ.D_ZHUANGBIAORQ;
            storedParams[13].Value = YS_CB_ZILAISGSSJ.S_JIANHAO;
            storedParams[14].Value = YS_CB_ZILAISGSSJ.I_KOUJING;
            storedParams[15].Value = YS_CB_ZILAISGSSJ.N_YSJ;
            storedParams[16].Value = YS_CB_ZILAISGSSJ.I_SHANGYUECM;
            storedParams[17].Value = YS_CB_ZILAISGSSJ.D_CHAOBIAORQ;
            storedParams[18].Value = YS_CB_ZILAISGSSJ.I_BENYUECM;
            storedParams[19].Value = YS_CB_ZILAISGSSJ.I_YONGSHUIL;
            storedParams[20].Value = YS_CB_ZILAISGSSJ.I_CHAOBIAOZT;
            storedParams[21].Value = YS_CB_ZILAISGSSJ.S_YUANCHAOBZT;
            storedParams[22].Value = YS_CB_ZILAISGSSJ.I_JLZT;
            storedParams[23].Value = YS_CB_ZILAISGSSJ.S_DEPT;
            storedParams[24].Value = YS_CB_ZILAISGSSJ.I_GJCS;
            storedParams[25].Value = YS_CB_ZILAISGSSJ.S_WATERCOMPANYID;
            storedParams[26].Value = YS_CB_ZILAISGSSJ.S_WRITEDEPTID;
            storedParams[27].Value = YS_CB_ZILAISGSSJ.S_CANTONID;
            storedParams[28].Value = YS_CB_ZILAISGSSJ.S_BFL;
            storedParams[29].Value = YS_CB_ZILAISGSSJ.S_ZBH;
            storedParams[30].Value = YS_CB_ZILAISGSSJ.I_ASSESSTYPE;
            storedParams[31].Value = YS_CB_ZILAISGSSJ.I_DUMMYWATCHFLAT;
            storedParams[32].Value = YS_CB_ZILAISGSSJ.S_YONGHUH;
            storedParams[33].Value = YS_CB_ZILAISGSSJ.I_WRITRTYPE;
            storedParams[34].Value = YS_CB_ZILAISGSSJ.S_BEIYONG1;
            storedParams[35].Value = YS_CB_ZILAISGSSJ.S_BEIYONG2;
            storedParams[36].Value = YS_CB_ZILAISGSSJ.S_BEIYONG3;
            storedParams[37].Value = YS_CB_ZILAISGSSJ.S_BEIYONG4;
            storedParams[38].Value = YS_CB_ZILAISGSSJ.S_BEIYONG5;
            storedParams[39].Value = YS_CB_ZILAISGSSJ.S_BEIYONG6;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            YS_CB_ZILAISGSSJ.ID = Convert.ToInt32(storedParams[40].Value);
            return result;
        }

        private bool UpdateYS_CB_ZILAISGSSJ(YS_CB_ZILAISGSSJ YS_CB_ZILAISGSSJ, OracleTransaction Transaction)
        {
            var spName = "CS_UpdYS_CB_ZILAISGSSJ";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_CB_ZILAISGSSJ.S_ZHANDIANBH;
            storedParams[1].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOBH;
            storedParams[2].Value = YS_CB_ZILAISGSSJ.I_Y;
            storedParams[3].Value = YS_CB_ZILAISGSSJ.I_M;
            storedParams[4].Value = YS_CB_ZILAISGSSJ.S_YUANSHUIBBH;
            storedParams[5].Value = YS_CB_ZILAISGSSJ.S_GUANLIKBH;
            storedParams[6].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOCH;
            storedParams[7].Value = YS_CB_ZILAISGSSJ.S_KUAIHAO;
            storedParams[8].Value = YS_CB_ZILAISGSSJ.I_TYPE;
            storedParams[9].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAODZ;
            storedParams[10].Value = YS_CB_ZILAISGSSJ.S_SHUIBIAOHM;
            storedParams[11].Value = YS_CB_ZILAISGSSJ.S_BX;
            storedParams[12].Value = YS_CB_ZILAISGSSJ.D_ZHUANGBIAORQ;
            storedParams[13].Value = YS_CB_ZILAISGSSJ.S_JIANHAO;
            storedParams[14].Value = YS_CB_ZILAISGSSJ.I_KOUJING;
            storedParams[15].Value = YS_CB_ZILAISGSSJ.N_YSJ;
            storedParams[16].Value = YS_CB_ZILAISGSSJ.I_SHANGYUECM;
            storedParams[17].Value = YS_CB_ZILAISGSSJ.D_CHAOBIAORQ;
            storedParams[18].Value = YS_CB_ZILAISGSSJ.I_BENYUECM;
            storedParams[19].Value = YS_CB_ZILAISGSSJ.I_YONGSHUIL;
            storedParams[20].Value = YS_CB_ZILAISGSSJ.I_CHAOBIAOZT;
            storedParams[21].Value = YS_CB_ZILAISGSSJ.S_YUANCHAOBZT;
            storedParams[22].Value = YS_CB_ZILAISGSSJ.I_JLZT;
            storedParams[23].Value = YS_CB_ZILAISGSSJ.S_DEPT;
            storedParams[24].Value = YS_CB_ZILAISGSSJ.I_GJCS;
            storedParams[25].Value = YS_CB_ZILAISGSSJ.S_WATERCOMPANYID;
            storedParams[26].Value = YS_CB_ZILAISGSSJ.S_WRITEDEPTID;
            storedParams[27].Value = YS_CB_ZILAISGSSJ.S_CANTONID;
            storedParams[28].Value = YS_CB_ZILAISGSSJ.S_BFL;
            storedParams[29].Value = YS_CB_ZILAISGSSJ.S_ZBH;
            storedParams[30].Value = YS_CB_ZILAISGSSJ.I_ASSESSTYPE;
            storedParams[31].Value = YS_CB_ZILAISGSSJ.I_DUMMYWATCHFLAT;
            storedParams[32].Value = YS_CB_ZILAISGSSJ.S_YONGHUH;
            storedParams[33].Value = YS_CB_ZILAISGSSJ.I_WRITRTYPE;
            storedParams[34].Value = YS_CB_ZILAISGSSJ.S_BEIYONG1;
            storedParams[35].Value = YS_CB_ZILAISGSSJ.S_BEIYONG2;
            storedParams[36].Value = YS_CB_ZILAISGSSJ.S_BEIYONG3;
            storedParams[37].Value = YS_CB_ZILAISGSSJ.S_BEIYONG4;
            storedParams[38].Value = YS_CB_ZILAISGSSJ.S_BEIYONG5;
            storedParams[39].Value = YS_CB_ZILAISGSSJ.S_BEIYONG6;
            storedParams[40].Value = YS_CB_ZILAISGSSJ.ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }


        private YS_CB_ZILAISGSSJ PopulateYS_CB_ZILAISGSSJ(IDataReader dr)
        {
            var YS_CB_ZILAISGSSJ = new YS_CB_ZILAISGSSJ();
            YS_CB_ZILAISGSSJ.S_ZHANDIANBH = dr["S_ZHANDIANBH"] == DBNull.Value ? null : (string) dr["S_ZHANDIANBH"];
            YS_CB_ZILAISGSSJ.S_SHUIBIAOBH = dr["S_SHUIBIAOBH"] == DBNull.Value ? null : (string) dr["S_SHUIBIAOBH"];
            YS_CB_ZILAISGSSJ.I_Y = dr["I_Y"] == DBNull.Value ? null : (decimal?) dr["I_Y"];
            YS_CB_ZILAISGSSJ.I_M = dr["I_M"] == DBNull.Value ? null : (decimal?) dr["I_M"];
            YS_CB_ZILAISGSSJ.S_YUANSHUIBBH = dr["S_YUANSHUIBBH"] == DBNull.Value ? null : (string) dr["S_YUANSHUIBBH"];
            YS_CB_ZILAISGSSJ.S_GUANLIKBH = dr["S_GUANLIKBH"] == DBNull.Value ? null : (string) dr["S_GUANLIKBH"];
            YS_CB_ZILAISGSSJ.S_SHUIBIAOCH = dr["S_SHUIBIAOCH"] == DBNull.Value ? null : (string) dr["S_SHUIBIAOCH"];
            YS_CB_ZILAISGSSJ.S_KUAIHAO = dr["S_KUAIHAO"] == DBNull.Value ? null : (string) dr["S_KUAIHAO"];
            YS_CB_ZILAISGSSJ.I_TYPE = dr["I_TYPE"] == DBNull.Value ? null : (decimal?) dr["I_TYPE"];
            YS_CB_ZILAISGSSJ.S_SHUIBIAODZ = dr["S_SHUIBIAODZ"] == DBNull.Value ? null : (string) dr["S_SHUIBIAODZ"];
            YS_CB_ZILAISGSSJ.S_SHUIBIAOHM = dr["S_SHUIBIAOHM"] == DBNull.Value ? null : (string) dr["S_SHUIBIAOHM"];
            YS_CB_ZILAISGSSJ.S_BX = dr["S_BX"] == DBNull.Value ? null : (string) dr["S_BX"];
            YS_CB_ZILAISGSSJ.D_ZHUANGBIAORQ =
                dr["D_ZHUANGBIAORQ"] == DBNull.Value ? null : (DateTime?) dr["D_ZHUANGBIAORQ"];
            YS_CB_ZILAISGSSJ.S_JIANHAO = dr["S_JIANHAO"] == DBNull.Value ? null : (string) dr["S_JIANHAO"];
            YS_CB_ZILAISGSSJ.I_KOUJING = dr["I_KOUJING"] == DBNull.Value ? null : (decimal?) dr["I_KOUJING"];
            YS_CB_ZILAISGSSJ.N_YSJ = dr["N_YSJ"] == DBNull.Value ? null : (float?) dr["N_YSJ"];
            YS_CB_ZILAISGSSJ.I_SHANGYUECM = dr["I_SHANGYUECM"] == DBNull.Value ? null : (decimal?) dr["I_SHANGYUECM"];
            YS_CB_ZILAISGSSJ.D_CHAOBIAORQ = dr["D_CHAOBIAORQ"] == DBNull.Value ? null : (DateTime?) dr["D_CHAOBIAORQ"];
            YS_CB_ZILAISGSSJ.I_BENYUECM = dr["I_BENYUECM"] == DBNull.Value ? null : (decimal?) dr["I_BENYUECM"];
            YS_CB_ZILAISGSSJ.I_YONGSHUIL = dr["I_YONGSHUIL"] == DBNull.Value ? null : (decimal?) dr["I_YONGSHUIL"];
            YS_CB_ZILAISGSSJ.I_CHAOBIAOZT = dr["I_CHAOBIAOZT"] == DBNull.Value ? null : (decimal?) dr["I_CHAOBIAOZT"];
            YS_CB_ZILAISGSSJ.S_YUANCHAOBZT = dr["S_YUANCHAOBZT"] == DBNull.Value ? null : (string) dr["S_YUANCHAOBZT"];
            YS_CB_ZILAISGSSJ.I_JLZT = dr["I_JLZT"] == DBNull.Value ? null : (decimal?) dr["I_JLZT"];
            YS_CB_ZILAISGSSJ.S_DEPT = dr["S_DEPT"] == DBNull.Value ? null : (string) dr["S_DEPT"];
            YS_CB_ZILAISGSSJ.I_GJCS = dr["I_GJCS"] == DBNull.Value ? null : (decimal?) dr["I_GJCS"];
            YS_CB_ZILAISGSSJ.S_WATERCOMPANYID =
                dr["S_WATERCOMPANYID"] == DBNull.Value ? null : (string) dr["S_WATERCOMPANYID"];
            YS_CB_ZILAISGSSJ.S_WRITEDEPTID = dr["S_WRITEDEPTID"] == DBNull.Value ? null : (string) dr["S_WRITEDEPTID"];
            YS_CB_ZILAISGSSJ.S_CANTONID = dr["S_CANTONID"] == DBNull.Value ? null : (string) dr["S_CANTONID"];
            YS_CB_ZILAISGSSJ.S_BFL = dr["S_BFL"] == DBNull.Value ? null : (string) dr["S_BFL"];
            YS_CB_ZILAISGSSJ.S_ZBH = dr["S_ZBH"] == DBNull.Value ? null : (string) dr["S_ZBH"];
            YS_CB_ZILAISGSSJ.I_ASSESSTYPE = dr["I_ASSESSTYPE"] == DBNull.Value ? null : (decimal?) dr["I_ASSESSTYPE"];
            YS_CB_ZILAISGSSJ.I_DUMMYWATCHFLAT =
                dr["I_DUMMYWATCHFLAT"] == DBNull.Value ? null : (decimal?) dr["I_DUMMYWATCHFLAT"];
            YS_CB_ZILAISGSSJ.S_YONGHUH = dr["S_YONGHUH"] == DBNull.Value ? null : (string) dr["S_YONGHUH"];
            YS_CB_ZILAISGSSJ.I_WRITRTYPE = dr["I_WRITRTYPE"] == DBNull.Value ? null : (decimal?) dr["I_WRITRTYPE"];
            YS_CB_ZILAISGSSJ.S_BEIYONG1 = dr["S_BEIYONG1"] == DBNull.Value ? null : (string) dr["S_BEIYONG1"];
            YS_CB_ZILAISGSSJ.S_BEIYONG2 = dr["S_BEIYONG2"] == DBNull.Value ? null : (string) dr["S_BEIYONG2"];
            YS_CB_ZILAISGSSJ.S_BEIYONG3 = dr["S_BEIYONG3"] == DBNull.Value ? null : (string) dr["S_BEIYONG3"];
            YS_CB_ZILAISGSSJ.S_BEIYONG4 = dr["S_BEIYONG4"] == DBNull.Value ? null : (string) dr["S_BEIYONG4"];
            YS_CB_ZILAISGSSJ.S_BEIYONG5 = dr["S_BEIYONG5"] == DBNull.Value ? null : (string) dr["S_BEIYONG5"];
            YS_CB_ZILAISGSSJ.S_BEIYONG6 = dr["S_BEIYONG6"] == DBNull.Value ? null : (string) dr["S_BEIYONG6"];
            YS_CB_ZILAISGSSJ.ID = dr["ID"] == DBNull.Value ? 0 : (decimal) dr["ID"];
            return YS_CB_ZILAISGSSJ;
        }


        private void AddRowNumber(DataTable dt)
        {
            dt.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            for (var i = 0; i < dt.Rows.Count; i++)
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
        }

        #endregion
    }
}

#endregion